package com.smart.common.bean.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 权限表
 *
 * @author yangbingquan
 * @version 1.0
 * @date 2021/5/12 16:15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "smart_permission")
public class Permission {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.INPUT)
    private Long id;

    /**
     * 权限名称
     */
    @TableField(value = "`name`")
    private String name;

    /**
     * 权限标识
     */
    @TableField(value = "perm")
    private String perm;

    /**
     * 请求方法类型（POST/PUT/DELETE/PATCH）
     */
    @TableField(value = "`method`")
    private String method;

    /**
     * 权限类型 1-路由权限 2-按钮权限
     */
    @TableField(value = "`type`")
    private Integer type;

    /**
     * 菜单模块ID
     */
    @TableField(value = "module_id")
    private Long moduleId;

    @TableField(value = "gmt_create")
    private LocalDateTime gmtCreate;

    @TableField(value = "gmt_modified")
    private LocalDateTime gmtModified;

    // 拥有资源权限角色ID集合
    @TableField(exist = false)
    private List<Long> roleIds;

    public static final String COL_ID = "id";

    public static final String COL_NAME = "name";

    public static final String COL_PERM = "perm";

    public static final String COL_METHOD = "method";

    public static final String COL_TYPE = "type";

    public static final String COL_MODULE_ID = "module_id";

    public static final String COL_GMT_CREATE = "gmt_create";

    public static final String COL_GMT_MODIFIED = "gmt_modified";
}